//package com.xyh.transaction.security;
//
//import com.xyh.transaction.utils.JwtUtil;
//import org.springframework.security.authentication.AuthenticationProvider;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.stereotype.Component;
//
//@Component
//public class AccountAuthenticationProvider implements AuthenticationProvider {
//    @Override
//    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
//
//        String token = authentication.getCredentials().toString();
//
//        if (JwtUtil.checkToken(token)){
//            return new AccountAuthenticationToken(token);
//        }else {
//            return new AccountAuthenticationToken("Invalid token");
//        }
//    }
//
//    @Override
//    public boolean supports(Class<?> authentication) {
//        return AccountAuthenticationToken.class.isAssignableFrom(authentication);
//    }
//
////    自定义Token的有效性检查逻辑，实际应用中根据需求实现
//    private boolean isValidToken(String token) {
//        // 自定义逻辑，例如检查数据库中的Token是否有效
//        return true;
//    }
//}
